" -------------------    公共部分  ---------------------
let mapleader=" "
let maplocalleader=" "
set backspace=indent,eol,start
set termencoding=utf-8
set fileencodings=utf-8,gbk,latin1
set fileformat=unix
" \r显示成ᶺM
" set binary
" 在保存的时候不自动在文件尾部添加换行符
set noendofline
set nocompatible
" 设置行号显示
set nu
set relativenumber
" vim 自身命令行模式智能补全
set wildmenu
" 开启实时搜索功能
set incsearch
"搜索忽略大小写
set ignorecase
" 总是显示状态栏
set laststatus=2
" 显示光标当前位置
set ruler
" 高亮显示当前行/列
set cursorline
set cursorcolumn
"搜索逐字符高亮
set hlsearch
" 禁止光标闪烁
set gcr=a:block-blinkon0
" 禁止显示滚动条
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R
" 禁止显示菜单和工具条
set guioptions-=m
set guioptions-=T
" 禁止折行
set nowrap
" 基于缩进或语法进行代码折叠
" set foldmethod=indent
" set foldmethod=syntax
" 启动 vim 时关闭折叠代码
" set nofoldenable

set smartindent
set tabstop=2
set shiftwidth=2
set expandtab



"-----------------------------------------
"
inoremap jk <Esc>
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
inoremap <C-i> <esc>^i
inoremap <C-a> <esc>$a
" 按ctrl+d删除当前行
inoremap <C-d> <esc>ddi
inoremap <C-o> <esc>o

vnoremap ;y "+y
" 退出视图模式
vnoremap v <Esc>

"-----------------------------------------

nnoremap ;; :set relativenumber!<CR>:set nu<CR>

nnoremap ;p "0p
nnoremap ;P "0P
nnoremap ;v "*p
nnoremap U <C-r>
nnoremap Y y$

" 移动到行首行尾
nnoremap J <C-d>
nnoremap K <C-u>
nnoremap H ^
nnoremap L $

nnoremap <leader>y yiw
nnoremap <leader>d diw
nnoremap <leader>c ciw
nnoremap <leader>p diw"0P
nnoremap <leader>P dd"0P
" 关闭窗口
nnoremap <Leader>qq  :wq<CR>
nnoremap <Leader>qa :wqa<CR>
nnoremap <Leader>w :w<CR>


" 给光标所在单词两边添加
nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lell
nnoremap <leader>( viw<esc>a)<esc>hbi(<esc>lell
nnoremap <leader>[ viw<esc>a]<esc>hbi[<esc>lell
nnoremap <leader>{ viw<esc>a}<esc>hbi{<esc>lell
nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>lell


" -------------------    公共部分  ---------------------
